package com.novel.controller;

import com.novel.service.impl.BooksService;
import com.reading.pojo.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/books")
public class BooksController {
    @Autowired
    private BooksService booksService;

    @RequestMapping("list")
    public List<Book> list(Integer pid) {
        return booksService.findall(pid);
    }

    //查询小说内容
    @RequestMapping("list1")
    public List<Book> list1(Integer pid,Integer chapterId) {
        return booksService.findall1(pid,chapterId);
    }

    @RequestMapping("findallbyid")
    public List<Book> findallbyid(Integer pid) {
        return  booksService.findallbyid(pid);
    }

}